package top.zackyoung.druid.simple.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author ZackYoung
 * @version 1.0
 * @date 2021/9/28
 */
@Slf4j
public class DynamicDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        String dataSource = DynamicDataSourceSwitcher.getDataSource();
        log.info("-------------------当前数据源：{}--------------------", dataSource);
        return dataSource;
    }
}
